package com.tedu.jiaodanote.controller;


import com.tedu.jiaodanote.commen.CommonResult;
import com.tedu.jiaodanote.entry.User;
import com.tedu.jiaodanote.service.NoteService;
import com.tedu.jiaodanote.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Author：毕龙
 * Date: 2024/7/8 14:39
 */
@Api(tags = "1 用户模块")
@RestController
@RequestMapping("/user")
@Slf4j
public class UserController {
    @Autowired
     private UserService    userService;
     @ApiOperation(value = "用户登录")
     @PostMapping("/login")
     public CommonResult login(@RequestBody User user) {
         log.debug("获取前端的收据：{}",user);
         boolean flag = userService.login(user);
         log.debug("{}",flag);
         if(flag){
             return CommonResult.success(flag);
         }else{
             return CommonResult.failed();
         }

     }
}
